import axios from 'axios';
import { loginreq, req,reqWithJSON,reqNoParams } from './axiosFun';
import de from "element-ui/src/locale/lang/de";

export const shopList = () => { return reqNoParams("post", "/api/m/bms/shop/page/1/100") };
export const sendSMS = (params) => {
  params.platType =parseInt(params.platTypeStr);
  return reqWithJSON("post", "/api/m/bms/shop/bind/sms",params) };

export const shopChange = (params) => {
  debugger
  if(params.type && params.type=='upd'){
    return reqNoParams("delete","/api/m/bms/shop/unbind/"+params.id)
  }else{
    params.platType =parseInt(params.platTypeStr);
    return reqWithJSON('post', "/api/m/bms/shop/bind", params)
  }
};



export const shopUserList = () => { return reqNoParams("post", "/api/m/bms/shopu/page/1/100") };
export const sendUserSMS = (params) => {
  params.platType =parseInt(params.platTypeStr);
  return reqWithJSON("post", "/api/m/bms/shopu/bind/sms",params) };

export const shopUserChange = (params) => {
  if(params.type && params.type=='upd'){
    return reqNoParams("delete","/api/m/bms/shopu/unbind/"+params.id)
  }else{
    params.platType =parseInt(params.platTypeStr);
    return reqWithJSON('post', "/api/m/bms/shopu/bind", params)
  }
};

export const allShops = (params) => {
  return reqNoParams('get', "/api/m/bms/shop/shops")
};


/**
 * 以下为第三方账号相关接口
 */
export const bindThirdAcct = (params) => {
  if(params.type==='upd'){
    debugger
    return reqNoParams('post', "/api/m/bms/platu/upwd/"+params.id+"/"+params.password)
  }else{
    params.platType =parseInt(params.platTypeStr);
    return reqWithJSON('post', "/api/m/bms/platu/bind", params)
  }
};

export const thirdAcctList = () => { return reqNoParams("get", "/api/m/bms/platu/page/1/30") };
export const refreshAcctShopList = (params) => { return reqNoParams("get", "/api/m/bms/platu/reShop/"+params.id) };
export const acctShopList = (params) => { return reqNoParams("get", "/api/m/bms/platu/shop/"+params.id+"/1/50") };
export const  unBindThirdAcct= (params) => { return reqNoParams("delete", "/api/m/bms/platu/disable/"+params.id) };
export const  refreshToken= (params) => { return reqNoParams("get", "/api/m/bms/platu/reToken/"+params.id) };
